//
//  FoodTableViewCell.m
//  LoveBeeProject
//
//  Created by dix on 2017/1/5.
//  Copyright © 2017年 斯芬克斯. All rights reserved.
//

#import "FoodTableViewCell.h"
#import "FoodModel.h"
#import "CZAdditions.h"
//自定义背景
@interface HMFoodCategroyCellBgView : UIView

@end
@implementation HMFoodCategroyCellBgView

- (instancetype)init{
    self = [super init];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
    }
    return self;
}
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
    }
    return self;
}
- (void)awakeFromNib
{
    [super awakeFromNib];
    
    self.backgroundColor = [UIColor whiteColor];
}
- (instancetype)initWithCoder:(NSCoder *)coder
{
    self = [super initWithCoder:coder];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
    }
    return self;
}
- (void)drawRect:(CGRect)rect
{
    CGFloat w = 4;
    CGFloat h = 30;
    CGFloat x = 0;
    CGFloat y = (self.bounds.size.height - h) * 0.5;
    
    UIBezierPath * path = [UIBezierPath bezierPathWithRect:CGRectMake(x, y, w, h)];
    
    [[UIColor cz_colorWithHex:0xffd300] set];
    
    [path fill];
}

@end
@implementation FoodTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        //设置背景颜色
        self.backgroundColor = [UIColor cz_colorWithHex:0xefefef];
        self.textLabel.font = [UIFont systemFontOfSize:14.f];
        self.textLabel.textColor = [UIColor cz_colorWithHex:0x2f2f2f];
        HMFoodCategroyCellBgView * bgView = [[HMFoodCategroyCellBgView alloc] init];
        bgView.frame = self.bounds;
        self.selectedBackgroundView = bgView;
    }
    
    return self;
}
- (void)setTitle:(NSString *)title{
    _title = title;
    self.textLabel.text = title;
}

@end
